<html>
<head><meta charset="utf-8"><title>Where are attributes located? · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Where.20are.20attributes.20located.3F.html">Where are attributes located?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="206022661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Where%20are%20attributes%20located%3F/near/206022661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Where.20are.20attributes.20located.3F.html#206022661">(Aug 05 2020 at 13:38)</a>:</h4>
<p>Hello. I'm trying to implement the <code>instruction_set</code> RFC. It <strong>seems</strong> like I have three main steps ahead:<br>
1) Allow people to put <code>#[instruction_set(?)]</code> on a function, where <code>?</code> is one of <code>arm::a32</code> or <code>arm::t32</code>.<br>
2) Store that attribute in the function's metadata.<br>
3) Use that function during llvm code generation to add/remove the appropriate llvm target attribute from the function.</p>
<p>Assuming that this is correct, where do I edit to start on step 1?</p>



<a name="206022862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Where%20are%20attributes%20located%3F/near/206022862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Where.20are.20attributes.20located.3F.html#206022862">(Aug 05 2020 at 13:40)</a>:</h4>
<p>There's a file with all built-in attributes, you need to add <code>instruction_set</code> there.</p>
<p>For 2) you can probably use the existing codegen attributes query.</p>



<a name="206023211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Where%20are%20attributes%20located%3F/near/206023211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Where.20are.20attributes.20located.3F.html#206023211">(Aug 05 2020 at 13:44)</a>:</h4>
<p>Which file though. I looked around in the rustc_ast crate and none seemed to be a big list of allowed attributes</p>



<a name="206023762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Where%20are%20attributes%20located%3F/near/206023762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Where.20are.20attributes.20located.3F.html#206023762">(Aug 05 2020 at 13:48)</a>:</h4>
<p>here I think: <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_feature/builtin_attrs.rs">https://github.com/rust-lang/rust/blob/master/src/librustc_feature/builtin_attrs.rs</a></p>



<a name="206024208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Where%20are%20attributes%20located%3F/near/206024208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Where.20are.20attributes.20located.3F.html#206024208">(Aug 05 2020 at 13:52)</a>:</h4>
<p>I forget step 0, "add a new feature flag".</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>